
(define (key record)
    (car record)
)

(define (left-branch tree) (cadr tree))
(define (right-branch tree) (caddr tree))


(define (lookup given-key set-of-records)
    (cond 
        ((null? set-of-records) #f)
        ((= given-key (key (car set-of-records)))
            (car set-of-records)
        )
        ((> given-key (key (car set-of-records)))
            (lookup given-key (right-branch set-of-records))
        )
        (else
            (lookup given-key (left-branch set-of-records)) 
        )
    )
)

(define mytree-1
    (list (cons 7 "7") 
        (list (cons 3 "31111") 
            (list (cons 1 "1") `() `())
            (list (cons 5 "5") `() `()) 
        )
        (list (cons 10 "10") 
            (list (cons 9 "9") `() `()) 
            (list (cons 11 "11") `() `())
        )
    )
)
(display (lookup 3 mytree-1))
(newline)
(display (lookup 8 mytree-1))
(exit)
